package com.itheima.service.store.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.itheima.dao.store.OrdersDao;
import com.itheima.dao.system.RoleDao;
import com.itheima.domain.store.Orders;
import com.itheima.service.store.OrdersService;
import com.itheima.utils.DaoInstanceFactory;

import java.util.List;

/**
 * @Author:项磊
 * @Description:
 * @Date: Created in 19:01 2020/11/30
 * @ModifiedBy:
 */
public class OrdersServiceImpl implements OrdersService {
    @Override
    public List<Orders> findAll(String orderNum) {
        return DaoInstanceFactory.getMapper(OrdersDao.class).findAll(orderNum);
    }
//    @Override
//    public void save(Orders orders) {
//        OrdersDao ordersDao = DaoInstanceFactory.getMapper(OrdersDao.class);
//        orders.setId(UUID.randomUUID().toString());
//        ordersDao.save(orders);
//    }

    @Override
    public void delete(String ordersId) {
        DaoInstanceFactory.getMapper(OrdersDao.class).deleteOrderTravellerByOrderId(ordersId);
        DaoInstanceFactory.getMapper(OrdersDao.class).delete(ordersId);
    }

    @Override
    public Orders findOrdersById(String ordersId) {
        return DaoInstanceFactory.getMapper(OrdersDao.class).findOrdersById(ordersId);
    }
}
